<?php
if(!defined('OSBB')) {
	die();
}
//test

$template->set_file_alias("catrow", "Theme/Default/catrow.tpl");
$query = $db->query("SELECT c.ID AS cid,c.*,b.ID as bid,b.* FROM OSBB_category AS c LEFT JOIN OSBB_boards AS b ON b.CAT_ID=c.ID ORDER BY c.cat_order,b.board_order ASC");
if($db->num_rows($query) == 0) {
	$template->assign_vars(array("CONTENT"=>"No categories"));
} else {
$cur_cat = 0;
$cat_count = 0;
while($data = $db->fetch_assoc($query)) {
	if($data['cid'] != $cur_cat) {
		$template->assign_block_vars("catrow", array("CATEGORY_NAME"=>"<a href=\"index.php?viewcat={$data[cid]}\">$data[cat_name]</a>"));
		//echo '<a name="'.$data['cid'].'">';
		$cat_count++;
	}
	$template->assign_block_vars("catrow.board", array(
					 			 "BOARD_NAME"=>"<a href=\"index.php?viewboard={$data['bid']}\">{$data['board_name']}</a>",
								 "BOARD_ABOUT"=>$data['board_about'],
								 "LAST_ACTION"=>"Nothing"));
	$cur_cat = $data['cid'];
}
if($cat_count > 0) {
	$template->assign_vars(array("CONTENT"=>$template->parse("catrow")));
} else {
	$template->assign_vars(array("CONTENT"=>"No categories 1"));
}
}
?>